class Solution:
    def plusOne(self, digits):
        digits.reverse()
        stat = 1
        r = []
        for i in range(len(digits)):
            c = digits[i] + stat
            r.append(c % 10)
            stat = c // 10

        if stat != 0:
            r.append(stat)
        r.reverse()
        return r


if __name__ == '__main__':
    so = Solution()
    num1 = [9,9,9,9]
    r = so.plusOne(num1)
    print(r)
